{% extends "based/based.html" %}
{% block title %}{{_("主题配置文档")}}-{% endblock %}
{% block content %}
<div id="app" class="row">
    <div class="col-xs-12">
        <div class="panel">
            <div class="panel-body table-responsive">
                <!-- 文章头-->
                <h3>
                    {[name]}{{_("主题配置文档")}}
                </h3>
                <br>
                <article>
                    <!-- 正文-->
                    <div v-html="readme" v-highlight></div>
                    <!-- //正文-->
                </article>
            </div>
        </div>
    </div>
</div>

<script src="/theme/static/js/markdown/marked.min.js?v={{g.site_global.site_config.STATIC_FILE_VERSION}}"></script>
<link href="/theme/static/css/highlight-style-github.css?v={{g.site_global.site_config.STATIC_FILE_VERSION}}" rel="stylesheet">
<script src="/theme/static/js/highlight.js?v={{g.site_global.site_config.STATIC_FILE_VERSION}}"></script>
<script>

     Vue.directive('highlight',function (el) {
      let blocks = el.querySelectorAll('pre code');
      blocks.forEach((block)=>{
        hljs.highlightBlock(block)
      })
    })

    var vue = new Vue({
      el: '#app',
      delimiters:['{[', ']}'],
      data:{
            readme:{},
            name:""
      },
      filters: {
            formatDate: function (time) {
              return irrformatDate(time, "yyyy-MM-dd hh:mm");
            }
      }
    })

    // 加载完页面执行
    $(document).ready(function(){
        var url_s = get_url_parameter();
        vue.name = get_obj_value(url_s, "name");
        get_readme(vue.name);
    });

    function get_readme(name){

        var d ={
            name:name
        }

        var result = osrHttp("GET","/api/admin/theme", d, args={not_prompt:true});
        result.then(function (r) {
            vue.readme = r.data.readme;
            vue.readme = marked(vue.readme);
        });
    }

</script>
{% endblock %}